<template>
    <div>
        <!-- 面包屑导航 -->
        <div class="page_top">
            <div class="left_btn" @click="back">
                <img src="../../assets/image/back.png" alt="" />
            </div>
            <crumbs basetitle="工具" title="黑名单"></crumbs>
        </div>
        <div class="outtabbox">
            <div class="outtabitem" @click="changeouttab(0)">
                <div class="content">
                    <div :class="{ tabtext: true, blueactiveword: outtabflag === 0 }">企业黑名单</div>
                </div>
                <div class="border_b">
                    <div :class="{ line: true, blueactiveline: outtabflag === 0 }"></div>
                </div>
            </div>
            <div class="outtabitem" @click="changeouttab(1)">
                <div class="content">
                    <div :class="{ tabtext: true, blueactiveword: outtabflag === 1 }">派遣单位黑名单</div>
                </div>
                <div class="border_b">
                    <div :class="{ line: true, blueactiveline: outtabflag === 1 }"></div>
                </div>
            </div>
            <div class="outtabitem" @click="changeouttab(2)">
                <div class="content">
                    <div :class="{ tabtext: true, blueactiveword: outtabflag === 2 }">投保人员黑名单</div>
                </div>
                <div class="border_b">
                    <div :class="{ line: true, blueactiveline: outtabflag === 2 }"></div>
                </div>
            </div>
        </div>
        <div class="paddingbox">
            <div class="formbox">
                <div class="top">
                    <div class="toptext">筛选</div>
                    <div class="utils">
                        <div class="clear">
                            <img src="../../assets/image/容器.png" alt="">
                            <span>清除</span>
                        </div>
                    </div>
                </div>
                <div class="formcontent">
                    <div class="formitem">
                        <div class="formitemflexone">
                            <div class="lable">客户名称：</div>
                            <el-input v-model="input" style="width: 280px;" placeholder="请输入" clearable />
                        </div>
                        <div class="formitemflexone">
                            <div class="lable">分配业务员：</div>
                            <el-select v-model="value" class="m-2 inputw" placeholder="请选择">
                                <el-option v-for="item in options" :key="item.value" :label="item.label"
                                    :value="item.value" />
                            </el-select>
                        </div>
                        <div class="formitemflexone">
                            <div class="lable">业务员：</div>
                            <el-input v-model="input" style="width: 280px;" placeholder="请输入" clearable />
                        </div>
                    </div>
                    <div class="formbtnitem">
                        <el-button class="my_cancelbtn"><el-icon>
                                <Upload />
                            </el-icon>导出列表</el-button>
                        <el-button type="primary" class="my_btn"><el-icon>
                                <Plus />
                            </el-icon>新增名单</el-button>
                    </div>
                </div>
            </div>
            <div class="blacklisttable">
                <el-table :data="teamtableData" style="width: 100%; margin-top: 16px" height="500" :header-cell-style="{
                    background: '#FAFAFC',
                    color: '#202536',
                }">
                    <el-table-column align="center" prop="userName" label="姓名" />
                    <el-table-column align="center" prop="phone" label="手机号" />
                    <el-table-column align="center" prop="position" label="职位" />
                    <el-table-column align="center" prop="roleName" label="角色">
                    </el-table-column>
                    <el-table-column align="center" prop="isOpen" label="PC">
                        <template #default="scope">
                            <span v-if="scope.row.isOpen === 1">已开通</span>
                            <span v-else>未开通</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" label="操作" width="260">
                        <template #default="scope">
                            <div style="
                        display: flex;
                        align-items: center;
                        justify-content: space-around;
                      ">
                                <el-button link style="color: #0256ff"
                                    @click="setorcanceladmin(scope.row)">设置超级管理员</el-button>
                                <el-button link style="color: #0256ff" @click="changeroleapizzc(scope.row)">修改角色</el-button>
                                <el-dropdown>
                                    <span style="color: #0256ff" class="el-dropdown-link">
                                        更多
                                    </span>
                                    <template #dropdown>
                                        <el-dropdown-menu>
                                            <el-dropdown-item style="color: #0256ff" v-if="scope.row.isOpen === 0"
                                                @click="openpczzc(scope.row)">开通PC</el-dropdown-item>
                                            <el-dropdown-item style="color: #0256ff" @click="okornologin(scope.row)">{{
                                                scope.row.status === "0"
                                                ? "禁止登录"
                                                : "允许登录"
                                            }}</el-dropdown-item>
                                            <el-dropdown-item style="color: #0256ff"
                                                @click="openresetpasswordzzc(scope.row)">重置密码</el-dropdown-item>
                                            <el-dropdown-item v-if="scope.row.isAdmin === 1" style="color: #ee3737"
                                                @click="setadmins(scope.row)">
                                                取消管理员
                                            </el-dropdown-item>
                                            <el-dropdown-item v-if="scope.row.isAdmin === 0" style="color: #0256ff"
                                                @click="setadmins(scope.row)">
                                                设置管理员
                                            </el-dropdown-item>
                                        </el-dropdown-menu>
                                    </template>
                                </el-dropdown>
                            </div>
                        </template>
                    </el-table-column>
                </el-table>
                <pagination :total="teamtotal" :currentPage="teamcurrentPage" :pageSize="teampageSize"
                    @SizeChange="teamhandleSizeChange" @CurrentChange="teamhandleCurrentChange"></pagination>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import crumbs from '../../components/crumbs.vue'
import { ref, reactive, computed, watch, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
const router = useRouter()
const route = useRoute()
const outtabflag = ref(0)
const changeouttab = (i:any) => {
    outtabflag.value = i
}
const back = () => {
    window.history.back()
}
</script>

<style lang="scss" scoped>
.blacklisttable {
    margin-top: 16px;
    width: 100%;
    box-sizing: border-box;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 5px 24px 24px;
}

.paddingbox {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
}

.formbox {
    background-color: #ffffff;
    width: 100%;
    box-sizing: border-box;
    padding: 0 8px;
    border-radius: 8px;

    .formcontent {
        padding: 0 12px 16px;
        width: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .formbtnitem {
            margin-top: 13px;
        }

        .formitem {
            margin-top: 16px;
            display: flex;
            align-items: center;

            .formitemflexone {
                display: flex;
                align-items: center;
                margin-right: 42px;
            }

            .lable {
                font-size: 14px;
                color: #202536;
                margin-right: 8px;
            }
        }
    }

    .top {
        width: 100%;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        padding: 16px 8px;
        align-items: center;
        border-bottom: 1px solid #F4F4F7;

        .toptext {
            color: #3D3D3D;
            font-size: 14px;
        }

        .utils {
            display: flex;
            align-items: center;
        }

        .clear {
            cursor: pointer;
            margin-right: 20px;
            margin-left: 24px;
            color: #9497B1;
            font-size: 14px;

            img {
                width: 16px;
                height: 16px;
                margin-right: 6px;
                margin-bottom: -3px;
            }
        }
    }
}

.outtabbox {
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    padding: 0 24px;
    display: flex;
    align-items: center;
    background-color: #ffffff;

    .outtabitem {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 12px;
        min-width: 64px;
        margin-right: 32px;

        .border_b {
            width: 100%;
            height: 2px;
            box-sizing: border-box;
            padding: 0 14px;

            .line {
                width: 100%;
                background-color: #ffffff;
                height: 2px;
            }
        }

        .content {
            display: flex;
            align-items: center;
            margin-bottom: 12px;
            justify-content: center;
            min-width: 85px;
            position: relative;

            .tabtext {
                text-align: center;
                font-size: 16px;
                color: #9497B1;
            }

            .count {
                position: absolute;
                top: -5px;
                right: -4px;
                height: 14px;
                min-width: 16px;
                text-align: center;
                font-size: 12px;
                line-height: 14px;
                border-radius: 8px;
                background-color: #FF7642;
                color: #FFFFFF;
            }
        }
    }
}

.blueactiveword {
    color: #0256FF !important;
}

.blueactiveline {
    background-color: #0256FF !important;
}
</style>